From 16e38701b6b7755eabc909ad844df48f45f8b4f3 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 12 Feb 2020 23:44:09 +0100 Subject: [PATCH] testsuite: Don't use gdk_cairo_get_clip_rectangle() I want to remove it. --- testsuite/gsk/reftest-compare.c | 17 ++++++++--------- testsuite/reftests/reftest-compare.c | 18 +++++++++--------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/testsuite/gsk/reftest-compare.c b/testsuite/gsk/reftest-compare.c index f63af72419..21f5962d9c 100644 --- a/testsuite/gsk/reftest-compare.c +++ b/testsuite/gsk/reftest-compare.c @@ -27,20 +27,19 @@ get_surface_size (cairo_surface_t *surface, int *width, int *height) { - GdkRectangle area; cairo_t *cr; + double x1, x2, y1, y2; cr = cairo_create (surface); - if (!gdk_cairo_get_clip_rectangle (cr, &area)) - { - g_assert_not_reached (); - } + cairo_clip_extents (cr, &x1, &y1, &x2, &y2); + cairo_destroy (cr); - g_assert (area.x == 0 && area.y == 0); - g_assert (area.width > 0 && area.height > 0); + g_assert (x1 == 0 && y1 == 0); + g_assert (x2 > 0 && y2 > 0); + g_assert ((int) x2 == x2 && (int) y2 == y2); - *width = area.width; - *height = area.height; + *width = x2; + *height = y2; } static cairo_surface_t * diff --git a/testsuite/reftests/reftest-compare.c b/testsuite/reftests/reftest-compare.c index f63af72419..dc422089cd 100644 --- a/testsuite/reftests/reftest-compare.c +++ b/testsuite/reftests/reftest-compare.c @@ -27,22 +27,22 @@ get_surface_size (cairo_surface_t *surface, int *width, int *height) { - GdkRectangle area; cairo_t *cr; + double x1, x2, y1, y2; cr = cairo_create (surface); - if (!gdk_cairo_get_clip_rectangle (cr, &area)) - { - g_assert_not_reached (); - } + cairo_clip_extents (cr, &x1, &y1, &x2, &y2); + cairo_destroy (cr); - g_assert (area.x == 0 && area.y == 0); - g_assert (area.width > 0 && area.height > 0); + g_assert (x1 == 0 && y1 == 0); + g_assert (x2 > 0 && y2 > 0); + g_assert ((int) x2 == x2 && (int) y2 == y2); - *width = area.width; - *height = area.height; + *width = x2; + *height = y2; } + static cairo_surface_t * coerce_surface_for_comparison (cairo_surface_t *surface, int width, -- 2.30.2